** Replication Code for:
** Terrorism Activates Ethnocentrism to Explain Greater Willingness to 
** Sacrifice Civil Liberties: Evidence from Germany
** Authors: Christina Novak Hansen and Peter Thisted Dinesen 
** Date: 10/02/2021

*-------------------------------------------------------------------------------


*-------------------------------------------------------------------------------
*Appendix E: List of variables
*-------------------------------------------------------------------------------

clear all
use GGSS2016_analysis.dta
svyset xs11 [pweight=wghtpew], vce(linearized)

********************************************************************************


								***Table E1***

/*Means and standard deviations in table E1 are calculated for the studied sample
meaning those respondents in the pre- and post-attacks group with non-missing 
values on the relevant variables.

The calculated results have been transferred manually to word.*/


		*(1)Based on sample of respondents included in Models 1-3, Table 1*

*Dependent variables
alphawgt  st_terror1 st_terror2 st_terror3 [aweight = wghtpew] if st_terrori!=. ///
	& st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. ///
	& german==1, casewise item


svy: mean st_terrori if st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd
svy: mean st_terror1 if st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd
svy: mean st_terror2 if st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd
svy: mean st_terror3 if st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd

*Ethnocentrism
alphawgt st_foreign_advantage st_homocult st_imrights st_wlife st_immarry ///
	st_stranger st_imenrich st_imcoherence st_imsocial st_diversity ///
	[aweight = wghtpew] if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. ///
	& proedu2!=. & work2!=. & treatment1!=. & german==1, casewise item

svy: mean st_ethno if st_terrori!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd
svy: mean st_diversity if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd
svy: mean st_foreign_advantage if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd
svy: mean st_homocult if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd
svy: mean st_imenrich if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd
svy: mean st_imsocial if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd
svy: mean st_imcoherence if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd
svy: mean st_immarry if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd
svy: mean st_imrights if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd
svy: mean st_stranger if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd
svy: mean st_wlife if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd

*Post-attacks
tab treatment1 if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1

*Sociodemographic variables
tab sex if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
svy: mean age if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd
tab proedu2 if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
tab work2 if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1



		*(2)Based on sample of respondents included in Models 4-6, Table 1*
		
*Alternative dependent variables
alphawgt st_video st_email st_spyDE st_spyother [aweight = wghtpew] ///
	if st_surveillanceindex!=. & st_ethno!=. & sex!=. & st_age!=. ///
	& proedu2!=. & work2!=. & treatment1!=. & german==1, casewise item 

svy: mean st_surveillanceindex if st_surveillanceindex!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd
svy: mean st_video if st_surveillanceindex!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd
svy: mean st_email if st_surveillanceindex!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd
svy: mean st_spyDE if st_surveillanceindex!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd
svy: mean st_spyother if st_surveillanceindex!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd



		*(3)Based on sample of respondents included in Model 10, Table 1*

*Alternative independent variables
svy: mean st_authorchild if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd


	/*(4)Based on respondents with non-missing values on treatment variable,
		ethnocentrism index, and sociodemographic control variables*/

svy: mean st_lrID if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & treatment1!=. & german==1
estat sd


	/*(5)Based on respondents with non-missing values on alternative control variables,
		ethnocentrism index, and sociodemographic control variables*/

tab control_1 if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1
tab control_2 if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1
tab control_3 if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1


		*(1)Based on sample of respondents included in Models 1-3, Table 1*


*Contact variables
svy: mean st_phone if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1
estat sd
svy: mean st_housevisits if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1
estat sd
svy: mean st_othercontacts if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1
estat sd

*Bavaria dummy
tab statedummy if st_terrori!=. & st_ethno!=. & sex!=. & st_age!=. & proedu2!=. & work2!=. & german==1







